package main

import (
	"fmt"
	"time"
)

func generate(numRows int) [][]int {
	result := [][]int{}
	arrary := []int{}

	s := 1
	e := 0

	arrary = append(arrary, 1)
	for i := 2; i <= numRows; i++ {
		arrary = append(arrary, 1)
		for j := 1; j <= i-2; j++ {
			s = (i - j) * s / j
			// fmt.Print(s)
			arrary = append(arrary, s)
		}
		arrary = append(arrary, 1)
		// fmt.Println(arrary)
		s = 1
	}

	s = 0
	for i := 1; i <= numRows; i++ {
		e = s + i
		result = append(result, arrary[s:e])
		s += i

	}

	return result
}

func main() {
	start := time.Now()
	numRows := 10
	des := generate(numRows)
	cost := time.Since(start)
	fmt.Println(des)
	fmt.Println(cost)

}
